using UnityEngine;
using System.Collections;
using System;
using IFramework;
namespace IFramework
{
    public class IEnumeratorMgr : MonoSingleton<IEnumeratorMgr>
    {
        public Coroutine StartCoroutineTask(IEnumerator routine)
        {
            return Instance.StartCoroutine(routine);
        }
        private IEnumerator StartInnerCoroutine(IEnumerator routine, Action<object> callback)
        {
            yield return StartCoroutineTask(routine);
            callback(routine.Current);
        }
        public void StartCoroutineTask(IEnumerator routine, Action<object> callback)
        {
            StartCoroutineTask(StartInnerCoroutine(routine, callback));
        }
        public void StopCoroutineTask(IEnumerator routine)
        {
            Instance.StopCoroutine(routine);
        }
        public void StopAllCoroutineTask()
        {
            Instance.StopAllCoroutines();
        }
    }
}